﻿
namespace LearnMAUI2.Services;

//注意MAUI导航底层实现是异步的
public class RootNavigationService : IRootNavigationService
{
    private IRouteSerivice _routeSerivice;

    public RootNavigationService(IRouteSerivice routeService)
    {
        _routeSerivice = routeService;
    }

    public async Task NavigateToAsync(string page)
    {
        //MAUI标准导航，Shell是专门的内部框架用于处理导航，实际上就是AppShell
        //MAUI中两个//表示绝对地址，类似URL
        await Shell.Current.GoToAsync($"//{_routeSerivice.GeteRoute(page)}");
    }

    public Task NavigateToAsync(string page, object parameter)
    {
        throw new NotImplementedException();
    }
}
